package com.itheima.dao.OrderSetting;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author 陈英航
 * @since 2021/11/6 11:29
 */
public interface OrderSettingDao {

    /**
     * 添加
     * @param orderSetting
     */
    @Select("INSERT INTO t_ordersetting (orderDate,number,reservations) VALUES (#{orderDate},#{number},#{reservations})")
    public void add(OrderSetting orderSetting);

    /**
     * 根据日期修改人数
     * @param orderSetting
     */
    @Update("update t_ordersetting set number = #{number} where orderDate = #{orderDate}")
    public void update(OrderSetting orderSetting);

    /**
     * 根据预约日期查询
     * @param orderDate
     * @return
     */
    @Select(" select count(*) from t_ordersetting where orderDate = #{orderDate}")
    public  long findOrderDate(Date orderDate);

    /**
     *
     * @param date
     * @return
     */
    @Select(" select * from t_ordersetting where orderDate between #{dateBegin} and #{dateEnd}")
    public List<OrderSetting> getOrderSettingByMonth(Map date);


}
